<?php

use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;

class CreateUserPaperTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('user_paper', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->unsignedBigInteger('user_id',false)->default(0)->index()->comment('用户id');
            $table->unsignedBigInteger('paper_id',false)->default(0)->index()->comment('问卷id');
            $table->unsignedBigInteger('district_id',false)->default(0)->comment('地区id');
            $table->unsignedBigInteger('street_id',false)->default(0)->comment('街道id');
            $table->unsignedBigInteger('community_id',false)->default(0)->comment('社区id');
            $table->string('full_address')->nullable()->comment('地址');
            $table->string('build_no',10)->nullable()->comment('楼号');
            $table->string('unit_no',10)->nullable()->comment('单元号');
            $table->string('house_no',10)->nullable()->comment('房间号');
            $table->unsignedTinyInteger('all_score',false)->default(0)->comment('总分');
            $table->unsignedTinyInteger('question_num',false)->default(0)->comment('问题数量');
            $table->string('mask',200)->nullable()->comment('备注');
            $table->timestamps();
            $table->softDeletes();
            $table->engine="InnoDb";
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('user_paper');
    }
}
